package com.nulldev.util.web.HttpClient.clients.fuzzer;

import java.io.InputStream;
import java.io.Reader;

import com.nulldev.util.web.HttpClient.HttpRequest;
import com.nulldev.util.web.HttpClient.ResponseFormat;
import com.nulldev.util.web.HttpClient.providers.HttpClientProvider;
import com.nulldev.util.web.HttpClient.providers.websockets.HttpWebSocketRequest;

public class FuzzedProvider implements HttpClientProvider {

	@Override
	public HttpRequest<String> getString() {
		return new FuzzedHttpRequest<String>() {

			@Override
			public ResponseFormat getFormat() {
				return ResponseFormat.STRING_VIA_STREAM;
			}
		};
	}

	@Override
	public HttpRequest<byte[]> getBytes() {
		return new FuzzedHttpRequest<byte[]>() {

			@Override
			public ResponseFormat getFormat() {
				return ResponseFormat.BYTES;
			}

		};
	}

	@Override
	public HttpRequest<InputStream> getStream() {
		return new FuzzedHttpRequest<InputStream>() {

			@Override
			public ResponseFormat getFormat() {
				return ResponseFormat.STREAM;
			}

		};
	}

	@Override
	public HttpRequest<Reader> getReader() {
		return new FuzzedHttpRequest<Reader>() {

			@Override
			public ResponseFormat getFormat() {
				return ResponseFormat.READER;
			}

		};
	}

	@Override
	public HttpWebSocketRequest getSocket() {
		throw new UnsupportedOperationException("This provider doesn't support WebSockets.");
	}

	@Override
	public boolean isLegacyCompatible() {
		return true;
	}

	@Override
	public boolean providesRequests() {
		return true;
	}

	@Override
	public boolean providesWebSockets() {
		return false;
	}

	@Override
	public String getID() {
		return null;
	}

}
